package com.hnx.admin.utils;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/*
项目名称： core
创 建 人: 倔强的头发
创建日期： 2025/5/31   9:35:09 
描   述：
*/
public class ServletUtil {
    public static ServletRequestAttributes getRequestAttributes()
    {
        RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
        return (ServletRequestAttributes) attributes;
    }
    /**
     * 获取request
     */
    public static HttpServletRequest getRequest()
    {
        try {
            return getRequestAttributes().getRequest();
        }catch (Exception ex){
            return null;
        }
    }
}
